home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / BV0687.ZIP / BV0687.TXT
Text File  |  1993-01-10  |  17KB  |  398 lines

  1. ======================================================================
  2.     Microsoft Product Support Services Application Note (Text File)
  3.                    BV0687: HOW TO USE CALL INTERRUPT
  4. ======================================================================
  5.                                                   Revision Date: 11/92
  6.                                                       No Disk Included
  7.  
  8. The following information applies to Microsoft Basic Languages
  9. versions (see below).
  10.  
  11.  --------------------------------------------------------------------
  12. | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
  13. | ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
  14. | Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
  15. | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
  16. | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
  17. | PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
  18. | accuracy and the use of this Application Note. This Application    |
  19. | Note may be copied and distributed subject to the following        |
  20. | conditions: 1) All text must be copied without modification and    |
  21. | all pages must be included; 2) If software is included, all files  |
  22. | on the disk(s) must be copied without modification [the MS-DOS(R)  |
  23. | utility DISKCOPY is appropriate for this purpose]; 3) All          |
  24. | components of this Application Note must be distributed together;  |
  25. | and 4) This Application Note may not be distributed for profit.    |
  26. |                                                                    |
  27. | Copyright 1989-1992 Microsoft Corporation. All Rights Reserved.    |
  28. | Microsoft and MS-DOS are registered trademarks and Microsoft       |
  29. | QuickBasic, Visual Basic, and Windows are trademarks of Microsoft  |
  30. | Corporation. OS/2 is a registered trademark licensed to Microsoft  |
  31. | Corporation.                                                       |
  32.  --------------------------------------------------------------------
  33.  
  34.  
  35.                              INTRODUCTION
  36.                              ============
  37.  
  38. The information in this application note applies to:
  39.  
  40.  - The Standard and Professional Editions of Microsoft Visual Basic
  41.    for MS-DOS, version 1.0
  42.  - Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b, and 4.5
  43.  - Microsoft Basic Compiler for MS-DOS, versions 6.0 and 6.0b
  44.  - Microsoft Basic Professional Development System (PDS) for MS-DOS,
  45.    versions 7.0 and 7.1
  46.  
  47. The information in this application note is also included in the Help
  48. file provided with the Standard and Professional Editions of Microsoft
  49. Visual Basic for MS-DOS, version 1.0.
  50.  
  51. The CALL INTERRUPT and CALL INTERRUPTX statements documented in this
  52. application note are similar to the CALL INT86 and CALL INT86X
  53. statements supported in Microsoft QuickBasic for MS-DOS, versions 2.0,
  54. 2.01, and 3.0. The CALL INT86 and CALL INT86X statements also provide
  55. access to the ROM BIOS and MS-DOS interrupts but use an array
  56. interface instead of user-defined TYPEs. CALL INT86 and CALL INT86X
  57. are documented on pages 148-149 of the "Microsoft QuickBASIC Compiler"
  58. manual for versions 2.0, 2.01, and 3.0. Although there are
  59. differences, some of the information in this application note will be
  60. useful to those who use Microsoft QuickBasic for MS-DOS, versions 2.0,
  61. 2.01, and 3.0.
  62.  
  63. CALL INTERRUPT is a complicated statement that allows programmers to
  64. access low-level MS-DOS and ROM BIOS interrupts and to control these
  65. interrupts from Basic. Effective use of the complex CALL INTERRUPT
  66. interface requires an understanding of the Basic programming
  67. environment, the Basic language, and lower-level MS-DOS and ROM BIOS
  68. functions. This application note explains some of these topics,
  69. including the following:
  70.  
  71. 1. Libraries and Quick libraries
  72.  
  73. 2. User-defined TYPEs
  74.  
  75. 3. INCLUDE files
  76.  
  77. 4. CALL INTERRUPT input and output
  78.  
  79. 5. Differences between CALL INTERRUPT and CALL INTERRUPTX
  80.  
  81. The CALL INTERRUPT statement is designed to call only MS-DOS
  82. interrupts and is not supported in MS OS/2(R) protected mode. Most of
  83. the functions provided by MS-DOS interrupts are available in MS OS/2
  84. protected mode, but are accessed through application programming
  85. interface (API) calls. Most interrupts will work correctly in MS OS/2
  86. real mode (the MS-DOS version 3.x box).
  87.  
  88.  
  89.                      LIBRARIES AND QUICK LIBRARIES
  90.                      =============================
  91.  
  92. The object code for the interrupt routines is located in the
  93. VBDOS.LIB, VBDOS.QLB, QB.LIB, QB.QLB, QBX.LIB, and QBX.QLB files,
  94. which are supplied with Visual Basic for MS-DOS, version 1.0;
  95. Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b, and 4.5; Basic
  96. Compiler for MS-DOS, versions 6.0 and 6.0b; and Basic Professional
  97. Development System (PDS) for MS-DOS, versions 7.0 and 7.1.
  98.  
  99. The difference between LINK libraries (.LIB files) and Quick libraries
  100. (.QLB files) is that Quick libraries serve as executable code modules
  101. for use within the Visual Basic for MS-DOS or Microsoft QuickBasic
  102. programming environments, whereas LINK libraries are used at link time
  103. to produce executable programs.
  104.  
  105. To load a Quick library for use with the Visual Basic for MS-DOS or
  106. Microsoft QuickBasic programming environments, you must start Visual
  107. Basic for MS-DOS or Microsoft QuickBasic with the /L option (that is,
  108. "VBDOS /L VBDOS.QLB" or "QB /L QB.QLB" or "QBX /L QBX.QLB"). This will
  109. allow you to make CALLs to the routines in that Quick library. When
  110. you choose Make EXE File from the Run menu, your program will
  111. automatically be linked with the library (.LIB file) of the same name
  112. as your Quick library (in this case, VBDOS.LIB, QB.LIB, or QBX.LIB).
  113.  
  114.  
  115.                           USER-DEFINED TYPES
  116.                           ==================
  117.  
  118. To use the CALL INTERRUPT statement, you must first create a user-
  119. defined TYPE to contain the registers for the interrupt. The TYPEs are
  120. defined in the INCLUDE file (VBDOS.BI, QB.BI, or QBX.BI) that comes
  121. with Visual Basic for MS-DOS, version 1.0; with Microsoft QuickBasic
  122. for MS-DOS, versions 4.0, 4.0b, and 4.5; and Basic PDS for MS-DOS,
  123. versions 7.0 and 7.1. For example:
  124.  
  125.    TYPE RegType
  126.         ax    AS INTEGER
  127.         bx    AS INTEGER
  128.         cx    AS INTEGER
  129.         dx    AS INTEGER
  130.         bp    AS INTEGER
  131.         si    AS INTEGER
  132.         di    AS INTEGER
  133.         flags AS INTEGER
  134.    END TYPE
  135.    
  136.    TYPE RegTypeX                     ' See Note below.
  137.         ax    AS INTEGER
  138.         bx    AS INTEGER
  139.         cx    AS INTEGER
  140.         dx    AS INTEGER
  141.         bp    AS INTEGER
  142.         si    AS INTEGER
  143.         di    AS INTEGER
  144.         flags AS INTEGER
  145.         ds    AS INTEGER
  146.         es    AS INTEGER
  147.    END TYPE
  148.    
  149.   NOTE: RegTypeX is used with the CALL INTERRUPTX statement, which
  150.   allows you to specify the DS and ES registers. For more information
  151.   on CALL INTERRUPTX, please refer to the section "Differences Between
  152.   CALL INTERRUPT and CALL INTERRUPTX" later in this application note.
  153.  
  154.                                    
  155.                              INCLUDE FILES
  156.                              =============
  157.  
  158. To simplify the TYPE definition for interrupts, the INCLUDE file
  159. VBDOS.BI, QB.BI, or QBX.BI is shipped with Visual Basic for MS-DOS,
  160. version 1.0; with Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b,
  161. and 4.5; with Basic Compiler for MS-DOS, versions 6.0 and 6.0b; and
  162. with Basic PDS for MS-DOS, versions 7.0 and 7.1. VBDOS.BI, QB.BI, and
  163. QBX.BI have the TYPE definitions (see a TYPE example later in this
  164. application note) and SUB declarations needed for the interrupt. To
  165. use this file, place the metacommand $INCLUDE at the beginning of your
  166. code.
  167.  
  168. Use the following $INCLUDE statement for Visual Basic for MS-DOS:
  169.  
  170.    REM $INCLUDE: 'VBDOS.BI'
  171.  
  172. Use the following $INCLUDE statement for Microsoft QuickBasic for
  173. MS-DOS:
  174.  
  175.    REM $INCLUDE: 'QB.BI'
  176.  
  177. Use the following $INCLUDE statement for Basic PDS for MS-DOS:
  178.  
  179.    REM $INCLUDE: 'QBX.BI'
  180.  
  181. Please note the following:
  182.  
  183.  - The $INCLUDE m